import React, { Fragment, useState, useEffect, useCallback } from 'react'
import { Space, Table, Tag, Button, Form, Input, Radio } from 'antd';

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    key: 'name',
    render: (text) => <a>{text}</a>,
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age',
  },
  {
    title: 'Address',
    dataIndex: 'address',
    key: 'address',
  },
  {
    title: 'Tags',
    key: 'tags',
    dataIndex: 'tags',
    render: (_, { tags }) => (
      <>
        {tags.map((tag) => {
          let color = tag.length > 5 ? 'geekblue' : 'green';

          if (tag === 'loser') {
            color = 'volcano';
          }

          return (
            <Tag color={color} key={tag}>
              {tag.toUpperCase()}
            </Tag>
          );
        })}
      </>
    ),
  },
  {
    title: 'Action',
    key: 'action',
    render: (_, record) => (
      <Space size="middle">
        <a>Invite {record.name}</a>
        <a>Delete</a>
      </Space>
    ),
  },
];
const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    tags: ['nice', 'developer'],
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    tags: ['loser'],
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    tags: ['cool', 'teacher'],
  },
];
function Orderlist(props) {
  // 表单实例
  const [form] = Form.useForm();


  // 状态数据
  const [goodsList, setgoodsList] = useState([])
  const [pageNum, setPageNum] = useState(1)
  const [pageSize, setPageSize] = useState(10)
  const [total, setTotal] = useState(1)
  const [searchBanner, setSearchBanner] = useState({})

  // 根据条件查询分页数据
  const BannerPage = useCallback(async(detail) => {
    // let {list, pageNum, pageSize, total } = await getBannerPage(detail)
    // setBannerList(list)
    // setPageNum(pageNum)
    // setPageSize(pageSize)
    // setTotal(total)
  })

  useEffect(() => {
  }, [])

  const onFinish = useCallback((values) => {
    console.log('success', values)
  }, [])

  return (
    <Fragment>
      <div className='app_container'>
        <div className='app_container_header' style={{paddingBottom: 20}}>
          <Form
            layout={'inline'}
            form={form}
            onFinish={onFinish}
          >
            <Form.Item label="Field A">
              <Input placeholder="input placeholder" />
            </Form.Item>
            <Form.Item label="Field B">
              <Input placeholder="input placeholder" />
            </Form.Item>
            <Form.Item>
              <Button type="primary">提交</Button>
            </Form.Item>
          </Form>
        </div>
        <Table columns={columns} dataSource={data} />

      </div>
    </Fragment>
  )
}

export default Orderlist

